home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JPasswordField.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  3.1 KB  |  106 lines

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.io.IOException;
  5. import java.io.ObjectOutputStream;
  6. import javax.accessibility.AccessibleContext;
  7. import javax.swing.text.BadLocationException;
  8. import javax.swing.text.Document;
  9. import javax.swing.text.JTextComponent;
  10. import javax.swing.text.Segment;
  11.  
  12. public class JPasswordField extends JTextField {
  13.    private static final String uiClassID = "PasswordFieldUI";
  14.    private char echoChar;
  15.  
  16.    public JPasswordField() {
  17.       this((Document)null, (String)null, 0);
  18.    }
  19.  
  20.    public JPasswordField(int var1) {
  21.       this((Document)null, (String)null, var1);
  22.    }
  23.  
  24.    public JPasswordField(String var1) {
  25.       this((Document)null, var1, 0);
  26.    }
  27.  
  28.    public JPasswordField(String var1, int var2) {
  29.       this((Document)null, var1, var2);
  30.    }
  31.  
  32.    public JPasswordField(Document var1, String var2, int var3) {
  33.       super(var1, var2, var3);
  34.       this.echoChar = '*';
  35.    }
  36.  
  37.    public void copy() {
  38.       ((Component)this).getToolkit().beep();
  39.    }
  40.  
  41.    public void cut() {
  42.       ((Component)this).getToolkit().beep();
  43.    }
  44.  
  45.    public boolean echoCharIsSet() {
  46.       return this.echoChar != 0;
  47.    }
  48.  
  49.    public AccessibleContext getAccessibleContext() {
  50.       if (super.accessibleContext == null) {
  51.          super.accessibleContext = new AccessibleJPasswordField(this);
  52.       }
  53.  
  54.       return super.accessibleContext;
  55.    }
  56.  
  57.    public char getEchoChar() {
  58.       return this.echoChar;
  59.    }
  60.  
  61.    public char[] getPassword() {
  62.       Document var1 = ((JTextComponent)this).getDocument();
  63.       Segment var2 = new Segment();
  64.  
  65.       try {
  66.          var1.getText(0, var1.getLength(), var2);
  67.       } catch (BadLocationException var4) {
  68.          return null;
  69.       }
  70.  
  71.       char[] var3 = new char[var2.count];
  72.       System.arraycopy(var2.array, var2.offset, var3, 0, var2.count);
  73.       return var3;
  74.    }
  75.  
  76.    /** @deprecated */
  77.    public String getText() {
  78.       return super.getText();
  79.    }
  80.  
  81.    /** @deprecated */
  82.    public String getText(int var1, int var2) throws BadLocationException {
  83.       return super.getText(var1, var2);
  84.    }
  85.  
  86.    public String getUIClassID() {
  87.       return "PasswordFieldUI";
  88.    }
  89.  
  90.    protected String paramString() {
  91.       return super.paramString() + ",echoChar=" + this.echoChar;
  92.    }
  93.  
  94.    public void setEchoChar(char var1) {
  95.       this.echoChar = var1;
  96.    }
  97.  
  98.    private void writeObject(ObjectOutputStream var1) throws IOException {
  99.       var1.defaultWriteObject();
  100.       if (super.ui != null && this.getUIClassID().equals("PasswordFieldUI")) {
  101.          super.ui.installUI(this);
  102.       }
  103.  
  104.    }
  105. }
  106.